<?php #coding: utf-8 æ ø å 

/*Skal kaldes med variablene:
$stat_pot_vis
$stat_temp_vis
$level
$vis_samtlige
$racial_stat_bonus
*/


$stat_array = array("Lu", "Co", "Ag", "Re", "Me", "SD", "St", "Qu", "Pr", "Em", "In");
/*$stat_array_navne = array()
$stat_array_navne['lu'] = "Lu";
$stat_array_navne['co'] = "Co";
$stat_array_navne['ag'] = "Ag";
$stat_array_navne['re'] = "Re";
$stat_array_navne['me'] = "Me";
$stat_array_navne['sd'] = "SD";
$stat_array_navne['st'] = "St";
$stat_array_navne['qu'] = "Qu";
$stat_array_navne['pr'] = "Pr";
$stat_array_navne['em'] = "Em";
$stat_array_navne['in'] = "In";*/
//echo "<br>(view>karakterark/stats/vis_stats) Sstat_array er "; print_r($stat_array);
//echo "<br>(view>karakterark/stats/vis_stats) Sstat_temp_vis er "; print_r($stat_temp_vis);
//echo "<br>(view>karakterark/stats/vis_stats) Sstat_pot_vis er "; print_r($stat_pot_vis);
$stat_dif = array();
foreach($stat_array as $r){
	$stat_dif[$r] = $stat_pot_vis[$r] - $stat_temp_vis[$r];
}
//echo "<br>(view>karakterark/stats/vis_stats) Sstat_dif er "; print_r($stat_dif);

if(!isset($vis_samtlige)){
	$vis_samtlige = "ja";
}

//---- NORMAL STAT BONUS ---- (konstrueres)
$normal_stat_bonus = array();
foreach($stat_array as $r){
	$normal_stat_bonus[$r] = $this->karakterark_model->stat_bonus_distribution($stat_temp_vis[$r], "bonus");
}
//echo "<br>(view>karakterark/stats/vis_stats) Snormal_stat_bonus er "; print_r($normal_stat_bonus);

//---- RACIAL STAT BONUS ---- (er sendt med)
//echo "<br>(view>karakterark/stats/vis_stats) Sracial_stat_bonus er "; print_r($racial_stat_bonus);

//---- SPECIAL STAT BONUS ---- (konstrueres)
$special_stat_bonus = array();
foreach($stat_array as $r){
	$special_stat_bonus[$r] = 0;
}

//---- TOTAL STAT BONUS ---- (konstrueres)
$total_stat_bonus = array();
foreach($stat_array as $r){
	$total_stat_bonus[$r] = $normal_stat_bonus[$r] + $racial_stat_bonus[$r] + $special_stat_bonus[$r];
}
//---- DEVELOPMENT POINTS ---- (konstrueres)
$dev_pts = array();
foreach($stat_array as $r){
	$dev_pts[$r] = $this->karakterark_model->stat_bonus_distribution($stat_temp_vis[$r], "dev_pt");
}


		?>
		
<table class="rubrik" style="float:left;text-align:center;" >

			<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td width="120px" colspan="4"><p class="rubrik" ><b>Bonuses</b></p></td>
			</tr>
			<tr>
<td width="40px"><p class="rubrik"><b>Stat</b></p></td>
			<td width="40px"><p class="rubrik"><b>Temp</b></p></td>
			<td width="40px"><p class="rubrik"><b>Pot</b></p></td>
			<td width="40px"><p class="rubrik"><i>dif</i></p></td>
			<td><p>Normal</p></td>
			<td><p>Race</p></td>
			<td><p>Special</p></td>
			<td><p>Total</p></td>
			<td><p><b>DPs</b></p></td>
			</td>
			</tr>

<?
	$development_points = "ja";
	foreach($stat_array as $s){
		?>
			<tr>
			<td style="height:23px;"><? echo $s; ?></td>
			<td><? if(isset($stat_temp_vis[$s])){echo $stat_temp_vis[$s];} ?></td>
			<td><? if(isset($stat_pot_vis[$s])){echo $stat_pot_vis[$s];} ?></td>
			<td><i><? if(isset($stat_dif[$s])){echo $stat_dif[$s];} ?></i></td>
			<td><? if(isset($normal_stat_bonus[$s])){echo $normal_stat_bonus[$s];} ?></td>
			<td><? if(isset($racial_stat_bonus[$s])){echo $racial_stat_bonus[$s];} ?></td>
			<td><? if(isset($special_stat_bonus[$s])){echo $special_stat_bonus[$s];} ?></td>
			<td><? if(isset($total_stat_bonus[$s])){echo $total_stat_bonus[$s];} ?></td>
			<?
				if($development_points == "ja"){
					?>
					<td><? if(isset($dev_pts[$s])){echo $dev_pts[$s];} ?></td>
					<?
				}
			
		if($s == "SD"){
				$development_points = "nej";
		}
		if($s == "St"){
				?>
					<td>Total</td>
				<?
		}
		if($s == "Qu"){
				?> <td><b><u>
				<?
				echo $dev_pts['Lu']+$dev_pts['Co']+$dev_pts['Ag']+$dev_pts['Re']+$dev_pts['Me']+$dev_pts['SD'];
				?> </u></b></td> <?
		}
		?>
		</tr>
		<?
	}
?>
</table>
<div align="right">
<?

if($vis_samtlige == "ja"){
	echo "<p class='rubrik'><i>Andre levels:</i></p>";
		$counter = $level;
		while($counter > -1){
			echo anchor("core/vis/se/individ/".$stamdata['id']."/stats/level/".$counter, "<p>>> level ".$counter."</p>", "class='rubrik'");

			$counter = $counter - 1;
		}
}
?>

</div>

	

